﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<NerdDinner.Models.Dinner>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	Details
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

    

    <h2>Details</h2>

    <fieldset>
        <legend>Fields</legend>
        
        <div class="display-label">DinnerID</div>
        <div class="display-field"><%= Html.Encode(Model.DinnerID) %></div>
        
        <div class="display-label">Title</div>
        <div class="display-field"><%= Html.Encode(Model.Title) %></div>
        
        <div class="display-label">EventDate</div>
        <div class="display-field"><%= Html.Encode(String.Format("{0:g}", Model.EventDate)) %></div>
        
        <div class="display-label">Description</div>
        <div class="display-field"><%= Html.Encode(Model.Description) %></div>
        
        <div class="display-label">HostedById</div>
        <div class="display-field"><%= Html.Encode(Model.HostedById) %></div>
        
        <div class="display-label">HostedBy</div>
        <div class="display-field"><%= Html.Encode(Model.HostedBy) %></div>
        
        <div class="display-label">ContactPhone</div>
        <div class="display-field"><%= Html.Encode(Model.ContactPhone) %></div>
        
        <div class="display-label">Address</div>
        <div class="display-field"><%= Html.Encode(Model.Address) %></div>
        
        <div class="display-label">Country</div>
        <div class="display-field"><%= Html.Encode(Model.Country) %></div>
        
        <div class="display-label">Latitude</div>
        <div class="display-field"><%= Html.Encode(String.Format("{0:F}", Model.Latitude)) %></div>
        
        <div class="display-label">Longitude</div>
        <div class="display-field"><%= Html.Encode(String.Format("{0:F}", Model.Longitude)) %></div>
        
    </fieldset>
    <div id="rsvpmsg">
    <p>
    <%if (Model.IsHostBy(Context.User.Identity.Name))
      {%>
        <%=Html.ActionLink("Edit", "Edit", new {id = Model.DinnerID})%> |
        <%=Html.ActionLink("Back to List", "Index")%>
        <%
      }%>
    </p>
    <p>
        Description: 
        <%= Html.Encode(Model.Description) %>
    </p>
    <%if (Request.IsAuthenticated)
      {%>
          <%
        if (Model.IsUserRegistered(Context.User.Identity.Name))
        {%>
                <p>You have registered for this event</p> 
    
          <%
        }
        else
        {%>
            <script type="text/javascript">
                    function AnimationRSVPMsg() {
                        $("#rsvpmsg").animate({ fontSize: "1.5em" }, 400);
                        
                    }
                    $(".display-label").hide();
                    
            </script>
            <%= Ajax.ActionLink
                (
                    "CLICK here to register",
                    "Register",
                    "RSVP",
                    new { id = Model.DinnerID },
                    new AjaxOptions
                    {
                        UpdateTargetId = "rsvpmsg",
                        OnSuccess = "AnimationRSVPMsg"
                    }
                    )%>
          <%
        }%>
    <%}
      else
      {%>
        <a href="/Account/Logon"> LogOn </a> to RSVP for this event.
    <%}%>
    </div>



</asp:Content>

